/*
 * @Author: 谢小康 2170673706@qq.com
 * @Date: 2023-11-22 11:52:04
 * @LastEditors: 谢小康 2170673706@qq.com
 * @LastEditTime: 2024-01-31 13:20:26
 * @FilePath: \My-bolg\server\model\config.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
const { DataTypes } = require('sequelize');
const sq = require('./db.js')   
const moment = require('moment')
const configg = sq.define('configs', {
    Bolog_name:{
        type: DataTypes.STRING,
        allowNull: false,
        defaultValue: "阿康同学",
        comment: "博客名称",
    },
    Bolog_bkimg:{
        type: DataTypes.STRING,
        allowNull: false,
        defaultValue: "",
        comment: "博客背景",
    },
    Bolog_sign:{
        type:DataTypes.STRING,
        allowNull: false,
        comment: "博客签名",
    },
    Bolog_notice:{
        type:DataTypes.STRING,
        allowNull: false,
        comment: "博客公告",
    },
    Bolog_datatime:{
        type:DataTypes.STRING,
        allowNull: false,
        comment: "博客运行开始运行时间",
    },
    Bolog_view:{
        type:DataTypes.INTEGER,
        allowNull: false,
        defaultValue: 0,
        comment: "博客浏览量",
    },
    createdAt: {
        type: DataTypes.DATE,
        get() {
          return moment(this.getDataValue("createdAt")).format("YYYY-MM-DD HH:mm:ss")
        },
      },
      updatedAt: {
        type: DataTypes.DATE,
        get() {
          return moment(this.getDataValue("updatedAt")).format("YYYY-MM-DD HH:mm:ss")
        },
      },  
}, {
  // 这是其他模型参数
  freezeTableName: true,
  

});
/* configg.sync({ alter: true }) */
module.exports = configg;